package wang;

public class likou {
    public static void main(String[] args) {
        int[] arr = {3,3};
        int[] ints = twoSum(arr, 6);
        for (int anInt : ints) {
            System.out.println(anInt);

        }

    }


    public static int[] twoSum(int[] nums, int target) {
        int[] erb = new int[2];

        for (int i = 0; i < nums.length; i++) {
            int sum1 = nums[i];
            for (int z = i+1; z < nums.length; z++) {
                int sum2 = nums[z];
                int sum = sum1 + sum2;

                    if (sum == target) {
                        erb[0] = i;
                        erb[1] = z;
                        return erb;
                    }


            }
        }

        return erb;
    }
}
